Conversation
…rpolation
When yices_check_context_with_model,
yices_check_context_with_model_and_hint, or
yices_check_context_with_interpolation was called with assumption
variables whose type kind MCSAT cannot decide on (uninterpreted,
function, tuple, or finite-field types), Yices crashed with
mcsat/value.c:478: mcsat_value_construct_from_value:
Assertion `false' failed.
(or a SIGSEGV in release builds), inside the call stack:
mcsat_decide_assumption -> mcsat_value_construct_from_value(<unsupported>)
Root cause:
* mcsat_value_construct_from_value handles only BOOLEAN, RATIONAL,
ALGEBRAIC, FINITEFIELD, and BITVECTOR value kinds; it asserts(false)
on every other kind.
* Independently, the uf_plugin (decision-maker for UNINTERPRETED_TYPE
and FUNCTION_TYPE) and ff_plugin (decision-maker for FF_TYPE) have
decide_assignment == NULL, so even if value construction succeeded
the next step in mcsat_decide_assumption would dereference NULL.
* The API entry points only verified that the assumption term was
uninterpreted, not that its type was one MCSAT could actually decide
on, so unsupported types reached the solver and tripped the
assertion / crashed.
Fix: validate the type kind of every assumption term at the API
boundary and reject anything that is not BOOL_TYPE, INT_TYPE,
REAL_TYPE, SCALAR_TYPE, or BITVECTOR_TYPE (the type kinds whose
plugins provide a non-NULL decide_assignment).
A new error code MCSAT_ERROR_ASSUMPTION_TYPE_NOT_SUPPORTED
distinguishes "wrong type" (this fix) from the existing
MCSAT_ERROR_ASSUMPTION_TERM_NOT_SUPPORTED ("not an uninterpreted
term"). Both yices_check_context_with_model and
yices_check_context_with_model_and_hint now report the new code, and
yices_check_context_with_interpolation propagates it through its
internal yices_check_context_with_model call instead of crashing.
Files:
* src/api/yices_api.c -- new check_mcsat_assumption_types
helper plus _o_good_assumption_terms_for_mcsat;
wired into the two check_with_model
entry points.
* src/include/yices_types.h -- new MCSAT_ERROR_ASSUMPTION_TYPE_NOT_SUPPORTED.
* src/include/yices.h -- documented the new error code on
the affected functions.
* src/api/yices_error.c -- yices_print_error / yices_error_string.
* src/frontend/smt2/smt2_commands.c
-- SMT2 frontend error printer.
* tests/api/test_issue_615_assumption_type.c
-- regression test covering uninterpreted-sort,
function-type, supported-type, and
non-uninterpreted-term cases.
Verified:
* New regression test passes in debug and release.
* make MODE=release check 1705 pass / 0 fail.
* make MODE=release check-api 31/31 pass.
CI builds the api tests with -DNDEBUG -Werror=unused-variable, which turned every assert() into a no-op and produced 'unused variable s' errors on the smt_status_t locals. Replace assert() with a small CHECK() macro that is always live and calls exit(1) on failure, so the test fails as intended in both debug and release builds. Drop the now-unused <assert.h> include.
Match the codebase style: tests use assert() and rely on debug-mode CI to catch regressions. Silence the release-mode unused-variable warning on the smt_status_t locals with (void) s;.
|
Commit 1bf86b8 extends the issue 615 fix from “reject unsupported model assumptions before they crash MCSAT” to “support tuple-valued model assumptions when they can be safely reduced to existing MCSAT decision types.” The implemented plan was to keep function-valued tuple leaves out of scope, but allow tuples whose recursively flattened leaves are Bool, Int, Real, scalar, or BitVector. The API validation now accepts exactly those tuple types and still rejects tuples containing function, uninterpreted-sort, finite-field, or otherwise unsupported leaves with Internally, MCSAT now tuple-blasts tuple assumptions, recursively flattens the corresponding tuple value from the input model, and decides/caches each scalar leaf value instead of trying to convert the aggregate tuple value into a single The post-development conclusion is that tuple-valued input-model assumptions are now supported for the same scalar leaf types MCSAT already knows how to decide, without adding tuple support to Verification passed:
|
1bf86b8 to
1a84506
Compare
Generalize issue #615 model-assumption validation so tuple-typed assumption variables are accepted when every recursively flattened leaf has an MCSAT-decidable scalar type: Bool, Int, Real, scalar, or BitVector. Unsupported leaves such as uninterpreted-sort, function, and finite-field values still fail at the API boundary with MCSAT_ERROR_ASSUMPTION_TYPE_NOT_SUPPORTED. Carry flattened tuple model values alongside the tuple-blasted leaf variables used for MCSAT assumptions and model hints. Tuple assumption leaves also follow the scalar assumption preprocessing path, reasserting leaf equalities when preprocessing substituted a leaf before registering the public leaf as an assumption decision. Tuple hints intentionally remain advisory cache entries and do not assert preprocessing equalities. Keep scalar assumptions sound by constructing scalar model values through the rational plugin using the scalar constant index, and document that embedding. Preserve interpolation cleanup by popping both pushed contexts while retaining the original model-refutation error report. Document the tuple-blast helper contract, share tuple leaf/value collection across assumptions and hints, and make the malformed-model failure path explicit. Add regression coverage for scalar assumptions, scalar tuple leaves, repeat tuple-assumption solves, tuple assumptions with preprocessor substitutions, nested tuple flattening, tuple hints/interpolation, and unsupported tuple leaves.
1a84506 to
b53a140
Compare
|
Code review provided by Windsurf/Opus4.7: Code review —
|
Add regression coverage for tuple-valued model assumptions with omitted model entries and for interpolation error preservation when internal model refutation rejects unsupported assumption types.
…L/yices2 into fix-issue-615-interpolation-crash
|
Update on the coverage assessment after 2139806: Both gaps I'd flagged are now closed.
With these in, every non-trivial branch in the diff has at least one regression test that would fail if it regressed. No remaining coverage concerns from my side. |
When yices_check_context_with_model,
yices_check_context_with_model_and_hint, or
yices_check_context_with_interpolation was called with assumption variables whose type kind MCSAT cannot decide on (uninterpreted, function, tuple, or finite-field types), Yices crashed with
mcsat/value.c:478: mcsat_value_construct_from_value:
Assertion `false' failed.
(or a SIGSEGV in release builds), inside the call stack:
mcsat_decide_assumption -> mcsat_value_construct_from_value()
Root cause:
mcsat_value_construct_from_value handles only BOOLEAN, RATIONAL, ALGEBRAIC, FINITEFIELD, and BITVECTOR value kinds; it asserts(false) on every other kind.
Independently, the uf_plugin (decision-maker for UNINTERPRETED_TYPE and FUNCTION_TYPE) and ff_plugin (decision-maker for FF_TYPE) have decide_assignment == NULL, so even if value construction succeeded the next step in mcsat_decide_assumption would dereference NULL.
The API entry points only verified that the assumption term was uninterpreted, not that its type was one MCSAT could actually decide on, so unsupported types reached the solver and tripped the assertion / crashed.
Fix: validate the type kind of every assumption term at the API boundary and reject anything that is not BOOL_TYPE, INT_TYPE, REAL_TYPE, SCALAR_TYPE, or BITVECTOR_TYPE (the type kinds whose plugins provide a non-NULL decide_assignment).
A new error code MCSAT_ERROR_ASSUMPTION_TYPE_NOT_SUPPORTED distinguishes "wrong type" (this fix) from the existing MCSAT_ERROR_ASSUMPTION_TERM_NOT_SUPPORTED ("not an uninterpreted term"). Both yices_check_context_with_model and
yices_check_context_with_model_and_hint now report the new code, and yices_check_context_with_interpolation propagates it through its internal yices_check_context_with_model call instead of crashing.
Files:
helper plus _o_good_assumption_terms_for_mcsat;
wired into the two check_with_model
entry points.
the affected functions.
-- SMT2 frontend error printer.
-- regression test covering uninterpreted-sort,
function-type, supported-type, and
non-uninterpreted-term cases.
Verified: